package com.java.demo.controller;

import com.java.demo.entity.User;
import org.springframework.stereotype.Controller;

import javax.annotation.Resource;

@Controller
public class UserController2 {

    @Resource
    private User user;

    public void printUser2() {
        System.out.println("user -> " + user); // 预期：张三 -> 实际：悟空
        // Bean 作用域：默认是单例模式，此 Bean 在整个框架（Spring容器）中只有一份
    }
}
